/*
	For DayZ Epoch
	Addons Credits: Jetski Yanahui by Kol9yN, Zakat, Gerasimow9, YuraPetrov, zGuba, A.Karagod, IceBreakr, Sahbazz
*/

startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];

//REALLY IMPORTANT VALUES
dayZ_instance =	11;					//The instance
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;
server_name = "FOB";				// Watermark
setViewDistance 5000;				// Max View Distance

//disable greeting menu 
player setVariable ["BIS_noCoreConversations", true];
//disable radio messages to be heard and shown in the left lower corner of the screen
enableRadio false;
// May prevent "how are you civillian?" messages from NPC
enableSentences false;

//--------------------------------------------------------------------//
//------------------------DayZ Epoch Config---------------------------//
//--------------------------------------------------------------------//

// Map & Player Spawn Variables
spawnShoremode = 0; 								// Default: 1 (on shore)
spawnArea= 1500; 									// Default: 1500
dayz_paraSpawn = false;								// Default: false
dayz_fullMoonNights = true;							// Default: false
dayz_dawn = 1;										// Default: 6
dayz_dusk = 0; 									// Default: 18
dayz_MapArea = 14000; 								// Default = 10000
dayz_minpos = -1; 									// Do Not Edit - Chernarus Specific
dayz_maxpos = 16000;								// Do Not Edit - Chernarus Specific

// Item Spawn Variables
MaxHeliCrashes= 12; 									// Default: 5
OldHeliCrash = false;								// Default: false
MaxVehicleLimit = 350; 								// Default: 50
MaxDynamicDebris = 100; 							// Default: 100
MaxMineVeins = 50;									// Default: 50
MaxAmmoBoxes = 10;									// Default: 3
DZE_MissionLootTable = true;						// Default: false (Custom Mission Loot Table)
DZE_LootSpawnTimer = 10;							// Default: 10

// Zombie Variables
dayz_maxZeds = 500;									// Default: 500
dayz_maxLocalZombies = 15; 							// Default: 15 
dayz_maxGlobalZombiesInit = 15;						// Default: 15
dayz_maxGlobalZombiesIncrease = 5;					// Default: 5	
dayz_zedsAttackVehicles = false;					// Default: true
dayz_spawnAirCount = 0;								// Default: 0

// Animal Variables
dayz_maxAnimals = 5;								// Default: 5
dayz_tameDogs = false;								// Default: false

// Trader Variables
dayz_sellDistance_vehicle = 50;						// Default: 10
dayz_sellDistance_boat = 45;						// Default: 30
dayz_sellDistance_air = 60;							// Default: 40
DZE_TRADER_SPAWNMODE = false;						// Default: false
DZE_ConfigTrader = false;							// Default: false

/// Player Variables
DZE_R3F_WEIGHT = true;								// Default: true
DZE_FriendlySaving = false;							// Default: true
DZE_PlayerZed = false;								// Default: true
DZE_SelfTransfuse = true;							// Default: false
DZE_selfTransfuse_Values = [3000, 0, 300];			// Default: [12000, 15, 300]; = [blood amount, infection chance, cool-down (seconds)]
DZE_BackpackGuard = true;							// Default: true

// Default Starting Loadout
DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","DDOPP_3Rnd_X3","DDOPP_3Rnd_X3"]; 
DefaultWeapons = ["ItemMap","ItemToolbox","ItemHatchet_DZE","ItemKnife","DDOPP_X3_b"];
DefaultBackpack = "DZ_TerminalPack_EP1"; 
DefaultBackpackItems = ["ItemPainkiller"];

// Name Tags
DZE_ForceNameTags = false;							// Default: false
DZE_ForceNameTagsOff = true;						// Default: false
DZE_ForceNameTagsInTrader = true;					// Default: false
DZE_HumanityTargetDistance = 25;					// Default: 25

// Death Messages
DZE_DeathMsgGlobal = true;							// Default: false
DZE_DeathMsgSide = false;							// Default: false
DZE_DeathMsgTitleText = false;						// Default: false

// Vehicles Variables
DZE_AllowForceSave = false;							// Default: false
DZE_AllowCargoCheck = true;							// Default: false
DZE_HeliLift = true;								// Default: true
DZE_HaloJump = true;								// Default: true
DZE_AntiWallLimit = 3;								// Default: 3
DynamicVehicleDamageLow = 30; 						// Default: 0
DynamicVehicleDamageHigh = 100; 					// Default: 100
DZE_StripAmmo = ["BAF_Jackal2_L2A1_W", "Mi24_D", "BAF_Jackal2_GMG_W", "HMMWV_MK19", "HMMWV_Armored", "HMMWV_M2", "BRDM2_HQ_Gue", "BTR40_MG_TK_INS_EP1","Mi17_DZE","Mi17_Ins","Mi17_CDF","UH60M_EP1_DZE","UH1Y_DZE","MH60S_DZE","HMMWV_M998A2_SOV_DES_EP1_DZE","HMMWV_M1151_M2_CZ_DE_EP1_DZE","HMMWV_M1151_M2_CZ_DES_EP1","LandRover_Special_CZ_EP1_DZE","LandRover_MG_TK_EP1_DZE","UAZ_MG_TK_EP1_DZE","HMMWV_MK19_DES_EP1","ArmoredSUV_PMC_DZE","Pickup_PK_TK_GUE_EP1_DZE","Offroad_DSHKM_Gue_DZE","Pickup_PK_GUE_DZE","Pickup_PK_INS_DZE","Ka60_PMC","Ka60_GL_PMC","AW159_Lynx_BAF"];

// Build Variables
DZE_GodModeBase = false;							// Default: false
DZE_BuildingLimit = 150;							// Default: 150
DZE_requireplot = 1;								// Default: 1
DZE_PlotPole = [30,45];								// Default: [30,45] = [x,y]
DZE_maintainRange = ((DZE_PlotPole select 0)+20);   // Default: ((DZE_PlotPole select 0)+20);
DZE_BuildOnRoads = false; 							// Default: false
DZE_DamageBeforeMaint = 0.09;						// Default: 0.09
DZE_StaticConstructionCount = 0;					// Default: 0
DZE_snapExtraRange = 0;								// Default: 0

// Debugging
DZEdebug = false;									// Default: false
DZE_Debug_Damage = true;							// Default: true

// A Plot For Life
DZE_APlotforLife = true;
DZE_PlotOwnership = true;
DZE_modularBuild = true;


// Server Events
EpochEvents = [
//["any","any","any","any",0,"animated_crash_spawner"],
["any","any","any","any",30,"crash_spawner"],
["any","any","any","any",0,"crash_spawner"],
["any","any","any","any",15,"supply_drop"]
];

//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//

// currency mod vars
DZE_ConfigTrader = true;
DZE_AsReMix_PLAYER_HUD = false; //Open Custom 	AsReMix Player HUD

//Load in compiled functions
call compile preprocessFileLineNumbers "Scripts\Variables\Variables.sqf";						//Initialize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "Scripts\plotforlife\publicEH.sqf";			//Initialize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";	//Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "Scripts\Server_Compile\compiles.sqf";  					 	//Compile regular functions
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "Scripts\Server_Traders\server_traders.sqf";									//Compile trader configs
progressLoadingScreen 0.75;
call compile preprocessFileLineNumbers "Scripts\taser\fnc_server.sqf"; // Compile Taser Server Functions
progressLoadingScreen 1.0;

"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";

// Add taser functionality
[] execVM "\ddopp_taserpack\scripts\init_taser.sqf";
// Set effects control to player
player setVariable ["isTazed", false, true];
player addEventHandler ["HandleDamage",{_this call DDOPP_taser_handleHit}];

if (isServer) then {
	//Compile vehicle configs
	call compile preprocessFileLineNumbers "Scripts\dynamic_vehicle\dynamic_vehicle.sqf";
	
	//Add custom buildings
	_nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";
	
	//Server Monitor
	_serverMonitor = 	[] execVM "\z\addons\dayz_code\system\server_monitor.sqf";

};

if (!isDedicated) then {
	//Conduct map operations
	0 fadeSound 0;
	waitUntil {!isNil "dayz_loadScreenMsg"};
	dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
	
	//Run the player monitor
	_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
	_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
	
	//Add Service Points
	execVM "Scripts\service_point\service_point.sqf";

	//Lights
	//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
	
	// currency mod hud
	if (DZE_AsReMix_PLAYER_HUD) then {
	execVM "Scripts\Player_Hud\playerHud.sqf"
    };
};

//Start Dynamic Weather
execVM "Scripts\weather\DynamicWeatherEffects.sqf";

// Watermark
if (!isNil "server_name") then {
	[] spawn {
		waitUntil {(!isNull Player) and (alive Player) and (player == player)};
		waituntil {!(isNull (findDisplay 46))};
		5 cutRsc ["wm_disp","PLAIN"];
		((uiNamespace getVariable "wm_disp") displayCtrl 1) ctrlSetText server_name;
	};
};

// load currency mod scripts
execVM "Scripts\Gold_Coin_system\init.sqf";

// infiSTAR SafeZones
[] execVM 'Scripts\safezone\SafeZone.sqf';

// Run BIS Effects
#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"
